#include <iostream>
#include <cstring>
using namespace std;
	char m[11]={'O','O','T','T','F','F','S','S','E','N'};
int main(){
	int a[1000];
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	for(int i=0;i<n;i++){
		int sec;
		while(a[i]){
		sec=a[i]%10;
		cout<<m[sec];
		a[i]=a[i]/10;	
		}
		cout<<endl;
	}
}
